package com.lwq.designpattern.behavioralPatterns.strategyPattern;

/**
 * @ClassName
 * @Description 策略模式（Strategy Pattern）;一个类的行为或其算法可以在运行时更改。这种类型的设计模式属于行为型模式。
 * @Author liwq
 * @Date 2021/5/10 9:56
 * @Version 1.0
 */
public class StrategyPatternDemo {
    public static void main(String[] args) {
        Calculate calculate1 = new Calculate(new OperationAdd());
        System.out.println(calculate1.executeStrategy(10, 5));

        Calculate calculate2 = new Calculate(new OperationSubtract());
        System.out.println(calculate2.executeStrategy(10, 5));

        Calculate calculate3 = new Calculate(new OperationMultiply());
        System.out.println(calculate3.executeStrategy(10, 5));
    }

}
